package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 搜索订单类型：1-我购买的订单，2-我的活动订单，3-我的推广订单
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum OrderSelectTypeEnum {

    BUY(1, "我购买的订单"),
    SELL(2, "我的活动订单"),
    AGENT(3, "我的推广订单"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    OrderSelectTypeEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static OrderSelectTypeEnum typeOf(Integer value) {
        OrderSelectTypeEnum[] values = OrderSelectTypeEnum.values();
        for (OrderSelectTypeEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static OrderSelectTypeEnum typeOf(String name) {
        OrderSelectTypeEnum[] values = OrderSelectTypeEnum.values();
        for (OrderSelectTypeEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
